#include<bits/stdc++.h>
using namespace std;
class Tele
{
    private:
        //音量，电视编号，画面编号
        int voice,tvNumber,DrNumber;
        //模式
        string Mo;
        static int DVDnumber;
        static int TVnumber;
    public:
        Tele(int _tvN,int _DrN,string _mo):tvNumber(_tvN),DrNumber(_DrN),Mo(_mo)
        {
            voice=50;
            if(_mo=="DVD")
                DVDnumber+=1;
            else
                TVnumber+=1;
        }
        Tele()
        {
            voice=50;
        }
        void set(int _tvN,int _DrN,string _mo)
        {
            tvNumber=_tvN;
            DrNumber=_DrN;
            Mo=_mo;
            if(_mo=="DVD")
                DVDnumber++;
            else
                TVnumber++;
            voice=50;
        }
        friend void Control(Tele& tmp,string Mo,int changeVoice,int changeDr);
        void Print()
        {
            cout<<"第"<<tvNumber<<"号电视机--"<<Mo<<"模式--频道"<<DrNumber<<"--音量"<<voice<<endl;
        }
        void PrinEnd()
        {
            cout<<"播放电视的电视机数量为"<<TVnumber<<endl;
            cout<<"播放DVD的电视机数量为"<<DVDnumber<<endl;
        }
};
void Control(Tele& tmp,string Mo,int changeVoice,int changeDr)
{
    if(tmp.Mo!=Mo)
    {
        if(Mo=="DVD")
        {
            Tele::DVDnumber+=1;
            Tele::TVnumber-=1;
        }
        else
        {
            Tele::DVDnumber-=1;
            Tele::TVnumber+=1;
        }
    }
    tmp.Mo=Mo;
    if(Mo=="DVD")
    {
        tmp.DrNumber=99;
    }
    else
    {
        tmp.DrNumber=changeDr;
    }
    tmp.voice+=changeVoice;
    if(tmp.voice<0)
        tmp.voice=0;
    else if(tmp.voice>100)
        tmp.voice=100;
    tmp.Print();
}
int Tele::DVDnumber=0;
int Tele::TVnumber=0;
int main()
{
    int n;
    cin>>n;
    Tele* arr=new Tele[n];
    for(int i=0;i<n;++i)
    {
        arr[i].set(i+1,0,"TV");
    }
    int t;
    cin>>t;
    while(t--)
    {
        int i,k,x,changeVoice;
        cin>>i>>k>>x>>changeVoice;
        string tmMo;
        if(k==1)
            tmMo="TV";
        else if(k==2)
            tmMo="DVD";
        Control(arr[i-1],tmMo,changeVoice,x);
    }
    arr[0].PrinEnd();
    delete[] arr;
}